//
//  FavatorCell.m
//  庐山通
//
//  Created by zcj on 15-11-3.
//  Copyright (c) 2015年 郑朝军. All rights reserved.
//

#import "FavatorCell.h"
#import "HotModelFrame.h"
#import "HotModel.h"

@interface FavatorCell()
@property (nonatomic,weak)UILabel * topTitle;
@property (nonatomic,weak)UILabel *topTime;
@property (nonatomic,weak)UIImageView * middleImg;
@property (nonatomic,weak)UIImageView * avatarBottom;
@property (nonatomic,weak)UILabel *usernameBottom;
@property (nonatomic,weak)UILabel *middlePostion;
@property (nonatomic,weak)UILabel *middleTid;
@end
@implementation FavatorCell
+ (instancetype)FavatorCell:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString * ID = @"flowscou";
    FavatorCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
    return cell;
}
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        self.backgroundColor = [UIColor whiteColor];
        UILabel * topTitle = [[UILabel alloc]init];
        topTitle.font = [UIFont systemFontOfSize:8];
        topTitle.textAlignment = NSTextAlignmentLeft;
        topTitle.numberOfLines = 0;
        [self addSubview:topTitle];
        self.topTitle = topTitle;
        UILabel *topTime = [[UILabel alloc]init];
        topTime.font = [UIFont systemFontOfSize:8];
        topTime.textAlignment = NSTextAlignmentRight;
        topTime.numberOfLines = 0;
        [self addSubview:topTime];
        self.topTime = topTime;
        
        
        UIImageView * middleImg = [[UIImageView alloc]init];
        [self addSubview:middleImg];
        self.middleImg = middleImg;
        UILabel * middlePostion = [[UILabel alloc]init];
        middlePostion.numberOfLines = 0;
        middlePostion.font = [UIFont systemFontOfSize:11];
        middlePostion.textAlignment = NSTextAlignmentLeft;
        [self addSubview:middlePostion];
        self.middlePostion = middlePostion;
        
        UILabel * middleTid = [[UILabel alloc]init];
        middlePostion.numberOfLines = 0;
        middlePostion.font = [UIFont systemFontOfSize:8];
        middlePostion.textAlignment = NSTextAlignmentLeft;
        [self addSubview:middleTid];
        self.middleTid = middleTid;
        
        UIImageView * avatarBottom = [[UIImageView alloc]init];
        [self addSubview:avatarBottom];
        self.avatarBottom = avatarBottom;
        
        UILabel * usernameBottom = [[UILabel alloc]init];
        usernameBottom.font = [UIFont systemFontOfSize:8];
        usernameBottom.textAlignment = NSTextAlignmentRight;
        usernameBottom.numberOfLines = 0;
        [self addSubview:usernameBottom];
        self.usernameBottom = usernameBottom;
        // Initialization code
    }
    return self;
}
- (void)setHotModel:(HotModelFrame *)hotModel
{
    _hotModel = hotModel;
    HotModel * hot = hotModel.hotModel;
    
    self.topTitle.text = hot.title;
    self.topTitle.frame = hotModel.titleF;
    
    self.topTime.text = hot.posttime;
    self.topTime.frame = hotModel.posttimeF;
    
    [self.middleImg setImageWithURL:[NSURL URLWithString:hot.img] placeholderImage:[UIImage imageNamed:@"head_cou"]];
    self.middleImg.frame = hotModel.imgF;
    
    
    // 位置
    self.middlePostion.text = hot.position;
    self.middlePostion.frame = hotModel.positionF;
    
    // 品论
    self.middleTid.text = hot.tid;
    self.middleTid.frame = hotModel.tidF;
    
    //头像
    [self.avatarBottom setImageWithURL:[NSURL URLWithString:hot.avatar] placeholderImage:[UIImage imageNamed:@"chang"]];
    self.avatarBottom.frame = hotModel.avatarF;
    //    头像  用户名
    self.usernameBottom.text = hot.username;
    self.usernameBottom.frame = hotModel.usernameF;
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
